﻿@model MaguenBrokersMVC.Models.SeguroHogar
<script type="text/javascript">
    $(function () {
        $('#ProvinciaId').change(function () {
            var selectedProvinceId = $(this).val();
            $.getJSON('@Url.Action("AjaxGetLocalidades", "SeguroHogar")', { idProvincia: selectedProvinceId },
            function (cities) {
                var citiesSelect = $('#LocalidadId');
                citiesSelect.empty();
                $.each(cities, function (index, city) {
                    citiesSelect.append(
                        $('<option/>')
                            .attr('value', city.Value)
                            .text(city.Text)
                    );
                });
            });
        });
    });
</script>
@{
    ViewBag.Title = "Create";
}
<h2>
    Create</h2>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>SeguroHogar</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Nombre)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Nombre)
            @Html.ValidationMessageFor(model => model.Nombre)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Apellido)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Apellido)
            @Html.ValidationMessageFor(model => model.Apellido)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.TipoViviendaId, "TipoVivienda")
        </div>
        <div class="editor-field">
            @Html.DropDownList("TipoViviendaId", String.Empty)
            @Html.ValidationMessageFor(model => model.TipoViviendaId)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ProvinciaId, "Provincia")
        </div>
        <div class="editor-field">
            @Html.DropDownList("ProvinciaId", String.Empty)
            @Html.ValidationMessageFor(model => model.ProvinciaId)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.LocalidadId, "Localidad")
        </div>
        <div class="editor-field">
            @Html.DropDownList("LocalidadId", String.Empty)
            @Html.ValidationMessageFor(model => model.LocalidadId)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.MetrosCuadrados)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MetrosCuadrados)
            @Html.ValidationMessageFor(model => model.MetrosCuadrados)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ValorAElectronicos)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ValorAElectronicos)
            @Html.ValidationMessageFor(model => model.ValorAElectronicos)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.ValorMuebles)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ValorMuebles)
            @Html.ValidationMessageFor(model => model.ValorMuebles)
        </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
